{% extends 'Site1Bundle:Module:layout' %}
{% block content %}
{% for datarow in module.data %}
<form action="{% route module.getRoute('edit') with ['id': datarow.id] %}" method="post">
        <table border="1">
            <thead>
                <th>
                    #
                </th>
    {% for plugin in module %}
        <th {% if plugin.getFields()|length > 1 %} colspan="{{ plugin.getFields()|length }}" {% endif %} >
            {{ plugin.getTitle() }}
        </th>
    {% endfor %}
            </thead>
            <tr>
                <td>
                    <input type="hidden" value="{{ datarow.id }}" name="id[]" />
                    <input type="checkbox" {% if module.isHidden(0) %} checked="checked" {% endif %} name="hidden" />
                </td>
    {% for plugin in module %}
        {% for field in plugin %}
                <td>
                {% if field.getType() in ['int', 'string'] %}
                    <input type="text" value="{{ plugin.getFieldValue(field, datarow) }}" name="{{ field.name }}" />
                {% elseif field.getType() in ['text'] %}
                    <textarea rows="10" cols="20" name="{{ field.name }}">{{ plugin.getFieldValue(field, datarow) }}</textarea>
                {% endif %}
                </td>
        {% endfor %}
    {% endfor %}
            </tr>
{% endfor %}
            
            <tr>
                <td colspan="2"><input type="submit"/></td>
                <td colspan="2"><input type="reset"/></td>
            </tr>
        </table>
</form>
{% endblock %}